/*!
 * Copyright (c) 2010 Jacob Essex
 *
 * Dual licenced under MIT or GPL 3 licneces
 * 
 * See the GPL3 or MIT files in the main directory for details
 */

require.def('contentscript', ['lib/jquery'],
function(){
    var eventsCreated = {};
    var obj = {};

    obj.sendMessage = function(evt, arg, callback){
        window.evtCallback = callback;
        $('#'+evt).append('<div class="arg">'+arg+'</div>')
                  .append('<div class="callback">evtCallback</div>');

        var customEvent = document.createEvent('Event');
        customEvent.initEvent(evt, true, true);
        document.getElementById(evt).dispatchEvent(customEvent);
        
    }

    return obj;
});
